package com.cyandpos.pad.member;

import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;


import com.cyandpos.pad.R;
import com.cyandpos.pad.posdata.QueryMemberInfoResponse;
import com.cyandpos.pad.utils.CommonUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Derek on 2017/4/12.
 */

public class QueryMemberCentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private List<String> mDatas;

    public QueryMemberCentAdapter(QueryMemberInfoResponse member) {
        mDatas = new ArrayList<>();
        mDatas.add("会员卡号 : "+member.getCardCode());
        mDatas.add("姓名 : "+member.getVipName());
        mDatas.add("积分 : "+member.getValidCent());
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        RecyclerView.ViewHolder viewHolder = null;

        View view = null;
        view = CommonUtils.getViewById(parent.getContext(), R.layout.item_memberinfo_querymembercent);
        viewHolder = new CentDescribeHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {

        ((CentDescribeHolder) holder).textView.setText(mDatas.get(position));
    }

    @Override
    public int getItemCount() {
        return mDatas.size();
    }

    static class CentDescribeHolder extends RecyclerView.ViewHolder {
        private TextView textView;

        public CentDescribeHolder(View itemView) {
            super(itemView);
            textView = (TextView) itemView.findViewById(R.id.tv);

        }

    }
}
